package com.yunti.springboot.controller;


import com.yunti.springboot.annotation.Log;
import com.yunti.springboot.annotation.Permission;
import com.yunti.springboot.service.TaskJobService;
import com.yunti.springboot.vo.Result;
import com.yunti.springboot.vo.req.TaskJobReq;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * <p>
 * 定时任务调度表 前端控制器
 * </p>
 *
 * @author ytt
 * @since 2023-07-06
 */
@RestController
@RequestMapping("/taskJob")
public class TaskJobController {
    @Resource
    TaskJobService service;


    @PostMapping("/getList")
    public Result getList(@RequestBody TaskJobReq req){
        return service.getList(req);
    }


    @Log
    @Permission({"superAdmin"})
    @PostMapping("/del")
    public Result del(@RequestBody TaskJobReq req) {
        return service.del(req);
    }

    @Log
    @Permission({"superAdmin"})
    @PostMapping("/add")
    public Result add(@RequestBody TaskJobReq req) {
        return service.add(req);
    }

    @Log
    @Permission({"superAdmin"})
    @PostMapping("/edit")
    public Result edit(@RequestBody TaskJobReq req) {
        return service.edit(req);
    }

    @Log
    @Permission({"superAdmin"})
    @PostMapping("/run")
    public Result run(@RequestBody TaskJobReq job) {
        return service.run(job);
    }

    @Log
    @Permission({"superAdmin"})
    @PostMapping("/change")
    public Result change(@RequestBody TaskJobReq job) {
        return service.change(job);
    }
}
